from app import db


class Uploadex(db.Model):
    __tablename__ = 'tbl_uploadex'
    Stu_id = db.Column(db.String(10), primary_key=True)
    Ex_id = db.Column(db.String(10), primary_key=True)
    Ex_time = db.Column(db.DateTime, nullable=False)
    Ex_address = db.Column(db.String(200), nullable=True)

    def to_json(self):
        return {
            "Stu_id": self.Stu_id,
            "Ex_id": self.Ex_id,
            "Ex_time": str(self.Ex_time),
            "Ex_address": self.Ex_address
        }
